import { message } from 'ant-design-vue';
import axios from 'axios';

/**
 * Types
 */
import type { AxiosError } from 'axios';

/**
 * Axios
 */
axios.defaults.baseURL = import.meta.env.VITE_API_URL;

axios.interceptors.response.use(
    (response) => {
        return response;
    },
    (error: AxiosError) => {
        message.error(error.message);

        return Promise.reject(error);
    },
);

export default axios;
